﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace IngredSubTool
{
    public class Session
    {
        public String searchTerm { get; set; }
        public BookmarkView currentBookmark { get; set; }

        public Substitution selectedSub { get; set; }

        public List<Substitution> bookmarkSubs = new List<Substitution>();

        public List<Substitution> recentSubsList = new List<Substitution>();

        public List<Substitution> submittedSubs = new List<Substitution>();

        public List<Substitution> privateSubs = new List<Substitution>();

        public Type lastPage;

        public Type currentPage;

        public LinkedList<Type> previousPagesList = new LinkedList<Type>();

        public void addToPrevPageList(Type page)
        {
            if (previousPagesList == null)
            {
                previousPagesList.AddFirst(typeof(SearchView));

            }
            else
            {
                previousPagesList.AddLast(page);
            }
        }

        public void removeFromPrevPageList()
        {
            if (previousPagesList != null)
            {
                previousPagesList.RemoveLast();
            }
        }

        public Type getPrevPage()
        {
            if (previousPagesList != null)
            {
                return previousPagesList.Last.Value;

            }
            else
            {
                return typeof(SearchView);
            }
        }
    }
}
